package com.customization.test;

import com.api.cloudstore.EcodeFolderApi;

public class Sup {
    protected int x;
    protected int y;

    //后面会用到
    protected Object lock = new Object();

    synchronized void write1() {

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName() + "在写...");

        x = 1;
        y = 1;

    }
    synchronized void write2() {
        System.out.println(Thread.currentThread().getName() + "在写...");
        x = 2;
        y = 2;

    }
    synchronized void read() {
        System.out.println(Thread.currentThread().getName() + "在读...");
        System.out.println("X:" + x + "-->" + "Y:" + y);
    }
}
